package cn.bdqn.service.impl;

import cn.bdqn.mapper.HospitalizedMapper;
import cn.bdqn.service.HospitalizedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 住院的业务接口实现
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class HospitalizedServiceImpl implements HospitalizedService {
    @Autowired
    private HospitalizedMapper hospitalizedMapper;

    /**
     * 根据registrationId修改住院表的支付状态
     * @param registrationId
     * @return
     */
    @Override
    @Transactional( rollbackFor =Exception.class ,propagation = Propagation.REQUIRES_NEW)
    public int updateByRegistrationId(String registrationId) {
        return hospitalizedMapper.updateByRegistrationId(registrationId);
    }
    /**
     * 根据registrationId修改住院状态
     * @param registrationId
     * @return
     */
    @Override
    @Transactional( rollbackFor =Exception.class ,propagation = Propagation.REQUIRES_NEW)
    public int updateStatusByRegistrationId(String registrationId) {
        return hospitalizedMapper.updateStatusByRegistrationId(registrationId);
    }
}
